﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Prism.Games.GalEngine.Scripts.FunctionModel;

namespace Prism.Games.GalEngine.Scripts.Data.BranchSystem
{
    /// <summary>
    /// 判定条件。为在运行时提供动态判定。
    /// </summary>
    [Serializable]
    public class Condition : MarkedObject, IItemIncrementalMarkableHost
    {
        public Condition(IItemIncrementalMarkable host)
        {
            this.Value = 0;
            this.ConditionOperator = BranchSystem.ConditionOperator.Equal;
            this.Host = host;
        }

        private ConditionOperator conditionOperator;

        public ConditionOperator ConditionOperator
        {
            get { return conditionOperator; }
            set
            {
                if (value != this.conditionOperator)
                {
                    conditionOperator = value;
                    this.OnPropertyChanged("ConditionOperator");
                }
            }
        }

        private int value;

        public int Value
        {
            get { return this.value; }
            set
            {
                if (value != this.value)
                {
                    this.value = value;
                    this.OnPropertyChanged("Value");
                }
            }
        }

        private int role;

        public int Role
        {
            get { return role; }
            set
            {
                if (value != this.role)
                {
                    role = value;
                    this.OnPropertyChanged("Role");
                }
            }
        }

        private string roleName;

        public string RoleName
        {
            get { return roleName; }
            set { roleName = value; this.OnPropertyChanged("RoleName"); }
        }

        public IItemIncrementalMarkable Host
        {
            get;
            set;
        }
    }
}
